<?php
class CMlmcashlog extends Zend_Db_Table
{
	protected $_name;
	protected $_primary;

	public function __construct()
	{
		$this->_name = R_PRE."mlm_cash_log";
		$this->_primary = "log_id";
		parent::__construct();
		
	}
	
	public function getAll($page, $pageNum, $type, $uid = 0)
	{
		$where = array();
		if ($type != 5) {
			$where['statu = ?'] = $type;
		}
		if ($uid) {
			$where['uid = ?'] = $uid;
		}
		$offset = ($page - 1) * $pageNum;
		
		return $this->fetchAll($where, 'add_time desc', $pageNum, $offset);
	}
	
	public function getPageCount($pageNum, $type, $uid = 0)
	{
		$where = array();
		if ($type != 5) {
			$where['statu = ?'] = $type;
		}
		if ($uid) {
			$where['uid = ?'] = $uid;
		}
		$rows = $this->fetchAll($where);		
		return count($rows);
	}
}